let fn = (room, { socket, io, reg, user, NOTIFY, LEAVE_ROOM }, topic) => {
    try {
        let r = reg.getRoom(room)
        r.leave(user)
        let ui = user.toSender()
        r.broadcast(x => {
            s.socket().emit(LEAVE_ROOM, ui)
        })
        io.emit(LEAVE_ROOM, ui)
    } catch ({ message }) {
        return {
            topic,
            data: message
        }
    }
}

module.exports = fn